<!DOCTYPE html>
<html xmlns:th="http://www.thymefeaf.org">
<head>
    <meta charset="utf-8">
    <title>Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}"  media="all">
    <script th:src="@{/layui/layui.js}" charset="utf-8"></script>
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<form class="layui-from" action="" id="form1">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">车牌号</label>
            <div class="layui-input-inline">

                <input type="text" name="id" th:value="${order.id}"lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">名字</label>
            <div class="layui-input-inline">
                <input type="text" name="name" th:value="${order.name}" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-inline">
                <input type="text" name="user_name" th:value="${order.user_name}"lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">微信号</label>
            <div class="layui-input-inline">
                <input type="text" name="wechat_on" th:value="${order.wechat_on}"lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">联系方式</label>
            <div class="layui-input-inline">
                <input type="text" name="tel" th:value="${order.tel}" lay-verify="required|phone" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">购买车位</label>
            <div class="layui-input-inline">
                <input type="text" name="parkingspace" th:value="${order.parkingspace}"lay-verify="required|phone" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">住所</label>
            <div class="layui-input-inline">
                <input type="text" name="address" th:value="${order.address}" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">订单日期</label>
            <div class="layui-input-inline">
                <input type="text" name="order_date" th:value="${order.order_date}" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">价格</label>
            <div class="layui-input-inline">
                <input type="text" name="price" th:value="${order.price}"lay-verify="required|phone" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">订单号</label>
            <div class="layui-input-inline">
                <input type="text" name="order_id" th:value="${order.order_id}" lay-verify="int" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">更新日期</label>
            <div class="layui-input-inline">
                <input type="text" name="update_datetime" th:value="${order.update_datetime}" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="button" onclick="doSave()" class="layui-btn" lay-submit="" lay-filter="demo1">更新提交</button>

        </div>
    </div>

</form>


<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    var $,layer;
    layui.use(['form','laydate'], function(){
        var laydate = layui.laydate;
        $=layui.jquery;
        layer=layui.layer;
        laydate.render({
            elem: '#order_date'
        });})
    function doSave() {

        //发送post请求
        //语法:$.post(url,data,callback,type);

        // url(必须):发送请求的地址，String类型

        // data(可选):发送给后台的数据，以key/value形式{a:value1,b:value2}，即json格式

        // callback(可选):请求成功后的回调函数。因此，在后台的处理中，需要给JSONObject put一个是否成功的值，见下面例子。

        //type(可选):即第二个参数data的数据类型。如果有data传递给后台，则需要加上该类型。
        var requestData=$("#form1").serialize();//获取表单参数
        $.post("/parkingSpaceOrder/save",requestData,function (responseDate) {
            console.log(responseDate);
            if(responseDate.success == 1){
                layer.alert("修改成功",function () {
                    parent.layer.closeAll();
                });
            }else {
                layer.alert("修改失败",function () {
                    parent.layer.closeAll();
                });
            }
        });



    }
</script>

</body>
</html>